package com.yozinga;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.yozinga.fragment.AboutFragment;
import com.yozinga.fragment.NotificationsFragment;

public class SettingsActivity extends BaseActivity implements OnClickListener{
	
	TextView tvAbout,tvNotifications;
	NotificationsFragment notificationFragment;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.activity_settings);

		tvAbout = (TextView)findViewById(R.id.about);
		tvAbout.setOnClickListener(this);

		Button saveButton = (Button) findViewById(R.id.save);
		saveButton.setOnClickListener(this);

		tvNotifications = (TextView)findViewById(R.id.notification);
		tvNotifications.setOnClickListener(this);
		tvNotifications.setBackgroundResource(R.drawable.highlightedtab);

		notificationFragment = new NotificationsFragment();
		notificationFragment.setArguments(getIntent().getExtras());
		FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
		transaction.replace(R.id.flFragmentHolder, notificationFragment);
		transaction.commit();

	}

	@Override
	public void onClick(View v) {
		
		if(v.getId() == R.id.about){
			tvNotifications.setBackgroundResource(R.drawable.locationbluebackground);
			tvAbout.setBackgroundResource(R.drawable.highlightedtab);
			AboutFragment aboutFragment = new AboutFragment();
			aboutFragment.setArguments(getIntent().getExtras());
			FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
			transaction.replace(R.id.flFragmentHolder, aboutFragment);
			transaction.commit();
		}else if(v.getId() == R.id.notification){
			tvNotifications.setBackgroundResource(R.drawable.highlightedtab);
			tvAbout.setBackgroundResource(R.drawable.locationbluebackground);
			NotificationsFragment notificationFragment = new NotificationsFragment();
			notificationFragment.setArguments(getIntent().getExtras());
			FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
			transaction.replace(R.id.flFragmentHolder, notificationFragment);
			transaction.commit();
		}/*else if(v.getId() == R.id.save){
			notificationFragment.saveDetails(this);
		}*//*else if(v.getId() == R.id.ivBackButton){
			finish();
		}*/else{
			super.onClick(v);
		}
	}
}